// 商品相关请求
import request from '../request.js';
import {
    finsURL,
    findByIdURL,
    getShopURL,
    homeSeckillURL,
    scURL,
    homegoodsURL,
	emptyCarts,
    ljzfURL,
	goodsOrderURL,
    getShopCartURL,
    nowBuyURL,
    setCartsURL,
	nowPayURL
} from "../urls.js"
export default {
    //商城首页数据渲染
    getShop() {
        return request({
            url: getShopURL,
            method: 'get'
        })
    },
    // lin首页底部商品
    getHomeGoods() {
        return request({
            url: homegoodsURL,
            method: 'GET'
        })
    },
    // l首页秒杀区域
    getSeckillData() {
        return request({
            url: homeSeckillURL,
            method: 'GET'
        })
    },
    //商城首页点击商品类型获取该类型下的商品数据
    finShop(data) {
        return request({
            url: finsURL,
            method: 'GET',
            data
        })
    },
    findById(data) {
        return request({
            url: findByIdURL,
            method: 'GET',
            data
        })
    },
    //立即购买

    ljzf(data) {
        return request({
            url: ljzfURL,
            method: 'post',
            data
        })
    },
    //获取购物车商品信息
    getShopCart(data) {
        return request({
            url: getShopCartURL,
            method: "GET",
            data
        })
    },
    //购物车立即支付
    buyCart(data) {
        return request({
            url: nowBuyURL,
            method: "POST",
            data
        })
    },
    //设置购物车商品数量
    setCartsNum(data) {
        return request({
            url: setCartsURL,
            method: "PUT",
            data
        })
    },
    //删除购物车
    delShopCarts(data) {
        return request({
            url: setCartsURL,
            method: "delete",
			data
        })
    },
    //商品收藏
    sc(data) {
        return request({
            url: scURL,
            method: "post",
            data
        })
    },
	//清空购物车
	emptyCarts(data){
		return request({
			url:emptyCarts,
			method:"delete",
			data
		})
	},
	//查看商品订单
	lookGoodsOrder(data){
		return request({
			url:goodsOrderURL,
			method:"GET",
			data
		})
	},
	//点击立即支付
	nowPay(data){
		return request({
			url:nowPayURL,
			method:"PUT",
			data
		})
	}
}